// 自定义表单相关的mock数据
import { mock, Random } from 'mockjs'

// 获取表单字段
export const getFormField = mock({
  'code': 1,
  'msg': '操作成功',
  'data': {
    'formInfo': {
      'id': '@id',
      'name': '@cword(3, 8)表单',
      'title': '@cword(3, 8)表单',
      'diyname': '@word(5, 10)',
      'needlogin': '@boolean',
      'successtips': '提交成功',
      'redirecturl': '',
      'formtpl': 'default',
      'status': 'normal',
      'createtime': '@integer(1600000000, 1630000000)',
      'updatetime': '@integer(1600000000, 1630000000)'
    },
    'fieldsList|5-10': [{
      'id': '@id',
      'name': '@word(4, 8)',
      'type': '@pick(["string", "text", "editor", "image", "images", "number", "radio", "checkbox", "select", "array", "date", "time", "datetime"])',
      'title': '@cword(2, 4)',
      'content': '@cword(10, 20)',
      'defaultvalue': '',
      'rule': '@pick(["required", "digits", "letters", "date", "time", "email", "url", "qq", "IDcard", "tel", "mobile", "zipcode", "chinese", "username", "password"])',
      'msg': '',
      'ok': '',
      'tip': '@csentence(5, 10)',
      'length': '255',
      'isfilter': '@boolean',
      'status': 'normal',
      'createtime': '@integer(1600000000, 1630000000)',
      'updatetime': '@integer(1600000000, 1630000000)',
      'isrequire': '@boolean',
      'extend': '',
      'setting': {
        'table': 'cms_diyform_@id',
        'validate': {
          'required': '@boolean',
          'digits': '@boolean',
          'letters': '@boolean',
          'date': '@boolean',
          'time': '@boolean',
          'email': '@boolean',
          'url': '@boolean',
          'qq': '@boolean',
          'IDcard': '@boolean',
          'tel': '@boolean',
          'mobile': '@boolean',
          'zipcode': '@boolean',
          'chinese': '@boolean',
          'username': '@boolean',
          'password': '@boolean'
        },
        'list': {
          'show': '@boolean'
        },
        'search': {
          'show': '@boolean'
        }
      }
    }]
  }
})

// 提交表单
export const postForm = mock({
  'code': 1,
  'msg': '提交成功',
  'data': null
})

// 获取表单列表
export const getFormList = mock({
  'code': 1,
  'msg': '操作成功',
  'data': {
    'formList|5': [{
      'id': '@id',
      'name': '@cword(3, 8)表单',
      'title': '@cword(3, 8)表单',
      'diyname': '@word(5, 10)',
      'needlogin': '@boolean',
      'successtips': '提交成功',
      'redirecturl': '',
      'formtpl': 'default',
      'status': 'normal',
      'createtime': '@integer(1600000000, 1630000000)',
      'updatetime': '@integer(1600000000, 1630000000)'
    }]
  }
})

// 获取表单详情
export const getFormShow = mock({
  'code': 1,
  'msg': '操作成功',
  'data': {
    'formInfo': {
      'id': '@id',
      'name': '@cword(3, 8)表单',
      'title': '@cword(3, 8)表单',
      'diyname': '@word(5, 10)',
      'needlogin': '@boolean',
      'successtips': '提交成功',
      'redirecturl': '',
      'formtpl': 'default',
      'status': 'normal',
      'createtime': '@integer(1600000000, 1630000000)',
      'updatetime': '@integer(1600000000, 1630000000)'
    },
    'dataInfo': {
      'id': '@id',
      'form_id': '@id',
      'user_id': '@integer(1, 100)',
      'createtime': '@integer(1600000000, 1630000000)',
      'updatetime': '@integer(1600000000, 1630000000)',
      'status': 'normal',
      'name': '@cname',
      'mobile': '1@string("number", 10)',
      'email': '@email',
      'content': '@cparagraph(1, 3)'
    }
  }
})